package com.hfut;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class JavaIO {
	public static void main(String[] args) throws IOException {
		String fileName = System.getProperty("user.dir") + "\\test.txt";
		System.out.println(fileName);
		File file = new File(fileName);
		FileWriter fw = new FileWriter(file);
		fw.write("我是一个粉刷匠，粉刷本领强");
		fw.write("\r\n");
		fw.write("天上的星星参北斗啊");
		fw.flush();
		fw.close();
		
		FileReader fr = new FileReader(file);
		BufferedReader br = new BufferedReader(fr);
		String str = br.readLine();
		while(str != null) 
		{
			System.out.println(str);
			str = br.readLine();
		}
		fr.close();
		br.close();
		
	}
}
